<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="../../master.xhtml">

        <ui:define name="menuPrincipal">
            <ui:include src="../../menu/menuPrincipal.xhtml" /> 
        </ui:define>

        <ui:define  name="layoutLateral">
            <ui:decorate template="../../layoutLateral.xhtml">
                <ui:define name="TituloConteudoLateral">
                    <h:outputLabel value="Bom dia " for="idLoginUsuario" /> 
                    #{login.nomeUtilizador}
                </ui:define>
            </ui:decorate>
        </ui:define>


        <ui:define name="TituloConteudoPrincipal">
            Movimento
        </ui:define>


        <ui:define name="ConteudoPrincipal">

            <p:messages globalOnly="true"/>
            <h:form>
                <h:panelGrid columns="4">
                    <p:panel header="#{bundle.idMovimento}">
                        <h:outputText value="#{movimentoController.selected.idMovimento}" title="#{bundle.idMovimento}"/>
                    </p:panel>

                    <p:panel header="#{bundle.codDocumento}">
                        <h:outputText value="#{movimentoController.selected.codDocumento}" title="#{bundle.codDocumento}"/>
                    </p:panel>

                    <p:panel header="#{bundle.dataMovimento}">
                        <h:outputText value="#{movimentoController.selected.dataMovimento}" title="#{bundle.dataMovimento}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                        </h:outputText>
                    </p:panel>
                    
                    <p:panel header="#{bundle.dataDocumento} do Documento">
                        <h:outputText value="#{movimentoController.selected.dataDocumento}" title="#{bundle.dataDocumento}">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:outputText>
                    </p:panel>

                    <p:panel header="#{bundle.descricao}">
                        <h:outputText value="#{movimentoController.selected.descricao}" title="#{bundle.descricao}"/>
                    </p:panel>

                    <p:panel header="#{bundle.usuario}">
                        <h:outputText value="#{movimentoController.selected.idLogin.nomeUsuario}" title="#{bundle.usuario}"/>
                    </p:panel>
                </h:panelGrid>

                <p:separator /> 




                <p:outputPanel>  
                    <p:dataTable value="#{movimentoController.selected.movimentoContaCollection }" var="mov">  

                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Tipo de Movimento" />  
                            </f:facet>  
                            <h:outputText value="#{mov.tipoMovimentoConta}" />  
                        </p:column>  

                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="valor" />  
                            </f:facet>  
                            <h:outputText value="#{mov.valorMovimentoConta}" />  
                        </p:column>  

                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Natureza" />  
                            </f:facet>  
                            <h:outputText value="#{mov.idMoeda.codMoeda}" />  
                        </p:column>   

                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Conta" />  
                            </f:facet>  
                            <h:outputText value="#{mov.idConta.nomeConta}" />  
                        </p:column>   


                    </p:dataTable>  
                </p:outputPanel>  





                <p:commandButton action="#{movimentoController.destroyAndView}" value="#{bundle.eliminar}" ajax="false" />

                <p:commandButton action="#{movimentoBean.prepararRegistoMovimento}" value="#{bundle.criar}" ajax="false" />

                <p:commandButton action="listarMovimento" value="#{bundle.listar}" ajax="false" />

            </h:form>
        </ui:define>
    </ui:composition>

</html>
